<?php

/**
 * 更新数据结构
 **/

$prefix = \Phpcmf\Service::M()->prefix;

$table = $prefix.'member_paylog';
if (\Phpcmf\Service::M()->db->tableExists($table)) {
    if (!\Phpcmf\Service::M()->db->fieldExists('money', $table)) {
        \Phpcmf\Service::M()->query('ALTER TABLE `'.$table.'` ADD `money` decimal(10,2) NOT NULL COMMENT \'余额\'');
    }
}
//新增提现表
$tixianbiao = $prefix.'1_quan_tixian';
if (!\Phpcmf\Service::M()->db->tableExists($tixianbiao)) {
    \Phpcmf\Service::M()->query("CREATE TABLE IF NOT EXISTS `".$tixianbiao."` (
	`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
	`cid` int(10) UNSIGNED NOT NULL COMMENT '文档id',
	`uid` mediumint(8) UNSIGNED NOT NULL COMMENT 'uid',
	`money` decimal(10,2) UNSIGNED NOT NULL COMMENT 'RMB',
	`leixing` int(10) UNSIGNED NOT NULL COMMENT '类型',
	`erweima` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '收款码',
	`pingzheng` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '汇款凭证',
	`moren` int(5) UNSIGNED DEFAULT NULL COMMENT '默认',
	`tixianming` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '提现账号名',
	`tixianhao` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '提现号',
	`zhuangtai` int(5) UNSIGNED DEFAULT NULL,
	`inputtime` int(10) UNSIGNED NOT NULL COMMENT '操作时间',
	`endtime` int(10) UNSIGNED NOT NULL COMMENT '打款时间',
	PRIMARY KEY (`id`),
	KEY `uid` (`uid`),
	KEY `cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='提现表';");
}
//新增提现账号
$tixianbiao = $prefix.'1_quan_tixian_hao';
if (!\Phpcmf\Service::M()->db->tableExists($tixianbiao)) {
    \Phpcmf\Service::M()->query("CREATE TABLE IF NOT EXISTS `".$tixianbiao."` (
	`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
	`cid` int(10) UNSIGNED NOT NULL COMMENT '文档id',
	`uid` mediumint(8) UNSIGNED NOT NULL COMMENT 'uid',
	`leixing` int(10) UNSIGNED NOT NULL COMMENT '类型',
	`erweima` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '收款码',
	`moren` int(5) UNSIGNED DEFAULT NULL COMMENT '默认',
	`tixianming` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '提现账号名',
	`tixianhao` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '提现号',
	`inputtime` int(10) UNSIGNED NOT NULL COMMENT '操作时间',
	`endtime` int(10) UNSIGNED NOT NULL COMMENT '结束时间',
	PRIMARY KEY (`id`),
	KEY `uid` (`uid`),
	KEY `cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='提现账号表';");
}
